Question 1

Suppose the server returns the following JSON file:

{ 
  "items": [ 
    { 
      "title": "Carrot Cake", 
      "price": "24" 
    }, 
    { 
      "title": "Éclair", 
      "price": "10" 
    }, 
    { 
      "title": "Almond Malai Kulfi", 
      "price": "8" 
    } 
  ] 
} 

Which structs do you have to use to decode it?


Question 2

Using the correct structs you have defined in the previous question, which is the correct code for querying a REST API in each server asynchronously and decoding it into food items?


Question 3

Consider a function called reload that retrieves and decodes data from a remote server asynchronously and stores it in Core Data. Which steps would you follow to run that function as soon as a view starts?

Suppose the Core Data context called viewContext is already created and accessible to that view.


Question 4

Suppose you have a Core Data entity called Dessert which contains the following properties: name and size of type String , and price of type Float . Which is true for creating a new dessert in the database and populating it with data?

Suppose that the properties are defined like this in the Dessert custom class:

extension Dessert { 

    @NSManaged public var name: String?  
    @NSManaged public var price: Float 
    @NSManaged public var size: String? 


Question 5

Which of the following are true about sort descriptors? Select all that apply:


Question 6

Which of the following are true about NSPredicate ? Select all that apply:


Question 7

Which of the following are true about NSSortDescriptor ? Select all that apply: